<template>
  <div>
    <el-row>
      <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
      <el-col :span="8"><div class="grid-content bg-purple-light">

        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="用户名称">
            <el-input v-model="form.name"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">添加</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </div></el-col>
      <el-col :span="8"><div class="grid-content bg-purple"></div></el-col>
    </el-row>


  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        name: '',
      }
    }
  },
  methods: {
    onSubmit() {
      this.$axios.post('student/add',this.form).then((res)=>{
        if (res.data.code!=0){
          this.$message.error(res.data.data.mes);

        }else {

          this.$router.push('/')
        }
      })

    }
  }
}
</script>

<style>

</style>
